package com.zoro.barn.inner.service.documentsql.sql.controller;

import com.zoro.barn.api.documentsql.sql.BarnSqlCopyService;
import com.zoro.barn.dto.documentsql.sql.SqlCopyDto;
import com.zoro.barn.inner.service.documentsql.sql.service.SqlInfoService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zhaoxingwu
 */
@RequestMapping("/sql-copy")
@RestController
public class BarnSqlCopyServiceController implements BarnSqlCopyService {

    private final SqlInfoService sqlInfoService;

    public BarnSqlCopyServiceController(SqlInfoService sqlInfoService) {
        this.sqlInfoService = sqlInfoService;
    }

    @Override
    public void copySql(SqlCopyDto sqlCopyDto) {
        this.sqlInfoService.copySql(sqlCopyDto.getFromProjectId(), sqlCopyDto.getToProjectId(), sqlCopyDto.getToProjectName());
    }
}
